<!-- <script setup lang="ts">
//事件处理函数
import { ref } from 'vue'

const isShow = ref(true)
const toggle = () => {
  isShow.value = !isShow.value
}

</script>


<template>
  <div id="app">
    <button @click="toggle">切换显示隐藏</button>
    <h1 v-show="isShow">黑马程序员</h1>
  </div>
</template> -->
<script setup lang="ts">
import { ref } from 'vue'

const isShow = ref(false)
const toggle = (value:boolean,intro:string) => {
  isShow.value = !value
  alert(intro)
}

</script>


<template>
  <div id="app">
    <button @click="toggle(isShow,'你好')">切换显示隐藏</button>
    <h1 v-show="isShow">黑马程序员</h1>
  </div>
</template>